Skip to content

test: source-map parity test and gottp bug repros in test/ttpsuite - #109

Merged
roc-ops merged 1 commit into
mainfrom
test/baseline-step3
Nov 28, 2026
Merged

roc-ops merged 1 commit into
mainfrom
test/baseline-step3

Conversation

@roc-ops

@roc-ops roc-ops commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

Baseline step 3 for #60. Tests and issues only; no gottp code changes.

                    ┌─ source maps off ─ Runtime.Parse ──────────────┐
 210 cases ─────────┤                                                ├─ same data? ── 199 yes
 (200 TTP suite     └─ source maps on ── Runtime.ParseWithSourceMap ─┘               11 no → #105 #106 #107 #108
  + 10 gottp repros)
                    └─ Python-style API vs Python TTP 0.10.1 ─ repros: 1 pass, 9 skipped by #28–#36
  • TestSourceMapParity (new sourcemap_parity_test.go): parses every test/ttpsuite case and every repro through CompiledTemplate.ParseWithValidation with source maps off and on and requires the same data (or the same error). The source map itself isn't compared. sourcemap_divergences.json uses the stale-proof rules of known_failures.json: an unlisted divergence, a listed case at parity and a stale entry all fail.
  • TestGottpRepros: the spike's nine repros as testdata/gottp-repros/NAME.{ttp,txt,expected.json}, expectations recorded from Python TTP 0.10.1, sharing known_failures.json with the suite, so each turns on when its issue is fixed. Plus sourcemap_void_group, which matches TTP but covers void for parity (no TTP suite case uses void).
  • record.py expect also re-records the repros, and now exits if an optional TTP dependency from requirements.txt is missing. With only ttp + PyYAML installed it ran and silently rewrote two suite expectations (test_N2G_formatter, test_group_functions); I reverted those.
  • ttpsuite_test.go: shared harness pulled out (runSuite, runWithTimeout, loadRepros, checkNoStaleEntries, enterPytestDir); TestTTPSuite behaves as before.
  • test/comparison isn't included: its cases are inline Go calls to RunComparison, not enumerable data.

Divergences (11 of 210)

Issue Cases Root cause
#105 5 A group without input= parses only Default_Input with source maps on (no fan-out to all inputs; input="a, b" also broken). Template-embedded and <extend>ed inputs give an empty result.
#106 4 Group errors lose the failed to parse group <name>: prefix.
#107 1 The ignore("<vars name>") empty-record special case exists only in Parse (coupled to #31).
#108 1 void isn't checked on the source-map path.

All four come from ParseWithSourceMap being a drifted copy of Parse. The review's other claims: the per_template _anonymous_ fold showed no divergence in a probe or in any case; processInputFunctions really isn't called on the source-map path, but no case shows a difference (noted in #105).

Evidence

$ go test ./test/ttpsuite -v | grep -E 'suite:|repros:|parity:'
source-map parity: same 199 / diverge 11 of 210
TTP 0.10.1 suite: pass 22 / skipped-by-issue 174 / design 4 of 200
gottp repros: pass 1 / skipped-by-issue 9 / design 0 of 10
  • Stale-proofing checked by editing sourcemap_divergences.json: a bogus name → "lists … which is not a case"; listing a case at parity → "is now at source-map parity: remove it"; dropping an entry → "not in sourcemap_divergences.json". Restored afterwards.
  • record.py expect --check with the full requirements.txt venv: 210 cases, 0 expectation(s) changed.
  • go vet ./..., go test ./... and go test -race (excluding test/memory, GOTTP_PYTHON set), staticcheck 2025.1.1 and GOOS=js GOARCH=wasm go build ./... all pass locally.

Merge Danger

Low. The change is in test/ttpsuite only. Risks:

  • Fixing a source-map or repro issue now fails go test until its table entry is removed. That's intended, and the failure message says so.
  • record.py refuses to run without the optional dependencies. That's intended, but anyone using a minimal venv now has to install test/ttpsuite/requirements.txt.

🤖 Generated with Claude Code

TestSourceMapParity parses all 200 TTP suite cases and the gottp repros
with source maps off and on and requires the same data. 11 of 210 diverge,
tracked in sourcemap_divergences.json by #105-#108.

TestGottpRepros replays the spike's nine repros (#28-#36) plus a void repro
against Python TTP 0.10.1's results, sharing known_failures.json. record.py
expect re-records them and now refuses to run without the optional TTP
dependencies, which otherwise silently change expectations.

Refs #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roc-ops
roc-ops merged commit 4065098 into main Nov 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant